//
//  MeHealthOrderCell.m
//  Ginix
//
//  Created by fzq on 2025/2/17.
//

#import "MeHealthOrderCell.h"

@interface MeHealthOrderCell()
@property (nonatomic,strong) UIView * bgView;
@property (nonatomic,strong) UILabel * timeLabel;
@property (nonatomic,strong) UILabel * typeLabel;
@property (nonatomic,strong) UIImageView * iconView;
@property (nonatomic,strong) UILabel * nameLabel;
@property (nonatomic,strong) UILabel * infoLabel;
@property (nonatomic,strong) UILabel * priceLabel;
@property (nonatomic,strong) UIView * lineView;
@property (nonatomic,strong) UIButton * enterBtn;
@end

@implementation MeHealthOrderCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    self.selectionStyle = UITableViewCellSelectionStyleNone;
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    if(self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]){
        self.backgroundColor = UIColor.clearColor;
        self.contentView.backgroundColor = UIColor.clearColor;
        [self setSubViewLayout];
    }
    return self;
}
-(void)setSubViewLayout{
    
    [self addSubview:self.bgView];
    [_bgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.right.equalTo(@0);
        make.bottom.mas_offset(-10 * FMScaleX);
    }];
    
    [self.bgView addSubview:self.timeLabel];
    [_timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_offset(20 * FMScaleX);
        make.left.mas_offset(15 * FMScaleX);
    }];
    [self.bgView addSubview:self.typeLabel];
    [_typeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_offset(-15 * FMScaleX);
        make.centerY.equalTo(self.timeLabel);
    }];
    [self.bgView addSubview:self.iconView];
    [_iconView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.mas_offset(CGSizeMake(100 * FMScaleX, 100 * FMScaleX));
        make.left.equalTo(self.timeLabel);
        make.top.equalTo(self.timeLabel.mas_bottom).offset(12 * FMScaleX);
    }];
    [self.bgView addSubview:self.nameLabel];
    [_nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.iconView.mas_right).offset(20 * FMScaleX);
        make.right.mas_offset(-15 * FMScaleX);
        make.top.equalTo(self.iconView);
    }];
    [self.bgView addSubview:self.infoLabel];
    [_infoLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.iconView.mas_right).offset(20 * FMScaleX);
        make.right.mas_offset(-15 * FMScaleX);
        make.top.equalTo(self.nameLabel.mas_bottom).offset(5 * FMScaleX);
    }];
    [self.bgView addSubview:self.priceLabel];
    [_priceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_offset(-15 * FMScaleX);
        make.top.equalTo(self.infoLabel.mas_bottom).offset(34 * FMScaleX);
    }];
    [self.bgView addSubview:self.lineView];
    [_lineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.priceLabel.mas_bottom).offset(17 * FMScaleX);
        make.right.mas_offset(-38 * FMScaleX);
        make.left.mas_offset(38 * FMScaleX);
        make.height.mas_offset(1);
    }];
    [self.bgView addSubview:self.enterBtn];
    [_enterBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_offset(-15 * FMScaleX);
        make.top.equalTo(self.lineView.mas_bottom).offset(20 * FMScaleX);
        make.size.mas_offset(CGSizeMake(100 * FMScaleX, 40 * FMScaleX));
    }];
}

-(UIView *)bgView{
    
    if(!_bgView){
        _bgView = [[UIView alloc]init];
        _bgView.backgroundColor = UIColor.whiteColor;
    }
    return _bgView;
}

-(UILabel *)timeLabel{
    
    if(!_timeLabel){
        _timeLabel = [[UILabel alloc]init];
        _timeLabel.font = Regular(12);
        _timeLabel.textColor = RDRGB(0x999999);
        _timeLabel.text = @"下单时间: 2024-09-12 09:56";
    }
    return _timeLabel;
}
-(UILabel *)typeLabel{
    
    if(!_typeLabel){
        _typeLabel = [[UILabel alloc]init];
        _typeLabel.text = @"支付成功";
        _typeLabel.font = Regular(12);
        _typeLabel.textColor = RDRGB(0xB6904A);
    }
    return _typeLabel;
}
-(UIImageView *)iconView{
    
    if(!_iconView){
        _iconView = [[UIImageView alloc]init];
        _iconView.image = [UIImage imageNamed:@"Me_heorder_icon"];
        _iconView.contentMode = UIViewContentModeScaleAspectFit;
    }
    return _iconView;
}
-(UILabel *)nameLabel{
    
    if(!_nameLabel){
        _nameLabel = [[UILabel alloc]init];
        _nameLabel.text = @"浙医健家庭健康礼包";
        _nameLabel.font = Regular(14);
        _nameLabel.textColor = RDRGB(0x333333);
    }
    return _nameLabel;
}
-(UILabel *)infoLabel{
    
    if(!_infoLabel){
        _infoLabel = [[UILabel alloc]init];
        _infoLabel.text = @"6个月";
        _infoLabel.font = Regular(12);
        _infoLabel.textColor = RDRGB(0x999999);
    }
    return _infoLabel;
}
-(UILabel *)priceLabel{
    
    if(!_priceLabel){
        _priceLabel = [[UILabel alloc]init];
        _priceLabel.text = @"共6个月实付:¥588";
        _priceLabel.font = Bold(22);
        _priceLabel.textColor = RDRGB(0xAD7D62);
    }
    return _priceLabel;
}
-(UIView *)lineView{
    
    if(!_lineView){
        _lineView = [[UIView alloc]init];
        _lineView.backgroundColor = RDRGB(0xF8F6F4);
    }
    return _lineView;
}
-(UIButton *)enterBtn{
    
    if(!_enterBtn){
        _enterBtn = [[UIButton alloc]init];
        [_enterBtn setCornerRadius:23 * FMScaleX];
        [_enterBtn setBackgroundColor:RDRGB(0xAD7D62)];
        [_enterBtn setTitleColor:UIColor.whiteColor forState:UIControlStateNormal];
        [_enterBtn setTitle:@"立即激活" forState:UIControlStateNormal];
    }
    return _enterBtn;
}
@end
